package com.hundsun.yr.universal.p2p.bean;

import android.text.TextUtils;
// TODO: 2017/5/9  销毁
/**
 * @Title: Invest.java
 * @Description: 投资列表
 * @date 2016-1-22 上午9:01:44
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com
 * @replace author:
 * @replace date:
 * @version V1.0
 */
public class Invest {
	
	/**
	 * 取值的key
	 */
	public static String BASEKEY="goodsList";

	/**
	 * 投资递增金额
	 */
	public static String ADDMNY = "addMny";
	/**
	 * 营销商品名称
	 */
	public static String KTGDSNAME = "ktgdsname";
	/**
	 * 年化收益率
	 */
	public static String ANULINCMRATE = "anulIncmRate";
	/**
	 * 可用数值 （根据投资控制类型区分是份额还是人员）
	 */
	public static String AVLNUM = "avlNum";
	/**
	 * 信用评级
	 */
	public static String CRGRD = "crGrd";
	/**
	 * ID信息
	 */
	public static String CRGRD_KEY = "key";
	/**
	 * 值信息
	 */
	public static String CRGRD_VALUE = "value";
	/**
	 * 销售结束时间
	 */
	public static String CRNENDTIME = "crnEndTime";
	/**
	 * 当期数值
	 */
	public static String CRNGDSNUM = "crnGdsNum";
	/**
	 * 当期已投数值
	 */
	public static String CRNHASIVSMNUM = "crnHasIvsmNum";
	/**
	 * 精选标识
	 */
	public static String CRNSELMARK = "crnSelMark";
	/**
	 * 当期销售开始时间
	 */
	public static String CRNSTARTTIME = "crnStartTime";
	/**
	 * 冻结数量
	 */
	public static String FREEZENUM = "freezeNum";
	/**
	 * 商品分类
	 */
	public static String GDSCL = "gdsCL";
	/**
	 * 商品ID
	 */
	public static String GDSID = "gdsId";
	/**
	 * 保障方式
	 */
	public static String GTDMODE = "gtdMode";
	/**
	 * 保障方式 ID信息
	 */
	public static String GTDMODE_KEY = "key";
	/**
	 * 保障方式值信息
	 */
	public static String GTDMODE_VALUE = "value";
	/**
	 * 担保机构 (非必填)
	 */
	public static String GTDORG = "gtdOrg";
	/**
	 * 担保机构 ID信息
	 */
	public static String GTDORG_KEY = "key";
	/**
	 * 担保机构 值信息
	 */
	public static String GTDORG_VALUE = "value";
	/**
	 * 计息方式
	 */
	public static String INTMODE = "intMode";
	/**
	 * 投资期限
	 */
	public static String IVSMTMLMT = "ivsmTmLmt";
	/**
	 * 投资期限类型
	 */
	public static String IVSMTMLMTTYPE = "ivsmTmLmtType";
	/**
	 * 借款人
	 */
	public static String LOANER = "loaner";
	/**
	 * 借款人id
	 */
	public static String LOANER_USERID = "userId";
	/**
	 * 营销商品状态( SCALEING("2", "销售中"),SCALE_COMPLETED("3", "销售完毕");)
	 */
	public static String MARKETGOODSSTATUS = "marketGoodsStatus";
	/**
	 * 单笔购买最大金额
	 */
	public static String MAXSINGLEMNY = "maxSingleMny";
	/**
	 * 累计购买最大金额
	 */
	public static String MAXTOTALMNY = "maxTotalMny";
	/**
	 * 营销商品ID
	 */
	public static String MKTGDSID = "mktGdsId";
	/**
	 * 营销商品名称
	 */
	public static String MKTGDSNAME = "mktGdsName";
	/**
	 * 总控额度 (根据控制类型，区分是金额还是名额）
	 */
	public static String NUM = "num";
	/**
	 * 商品详情
	 */
	public static String PRODUCTBASEPOJO = "productBasePojo";
	/**
	 * 还款方式
	 */
	public static String REFUNDWAY = "refundWay";
	/**
	 * 商品发布日期
	 */
	public static String RELEASEDATE = "releaseDate";
	/**
	 * 投资起点金额
	 */
	public static String STARTMNY = "startMny";
	/**
	 * 是否可转让(OK_TRANSFER("1", "允许"), NO_TRANSFER("2", "不允许");)
	 */
	public static String TRANSFERFLAG = "transferFlag";
	/**
	 * 是否新手标
	 */
	public static String NEWERONLY = "newerOnly";
	/**
	 * 剩余时间毫秒
	 */
	public static String REMAINTIME = "remainTime";
	
	
	/**
	 * 是否精选    精选  CHOICE("2", "精选"),  普通  ORDINARY("1", "普通");
	 * @param selMark
	 * @return
	 */
	public boolean ifSelMark(String selMark){
		
		if(TextUtils.equals(selMark, "CHOICE")){
			return true;
		}else{
			return false;
		}
	}
		
		
	
	/**
	 * 保障方式
	 * @param key
	 * @return
	 */
	public static String getgtdMode(String key) {
		String value="本息保障";
		
		if(TextUtils.equals(key, "1")){
			value="本息保障";
		}else if(TextUtils.equals(key, "2")){
			value="本金保障";
		}
		
		return value;
	}
	
	/**
	 * 产品期限
	 */
	public static final class Term {
		/**
		 * 不限
		 */
		public static String UNLIMIT = "UNLIMIT";
		/**
		 * 6个月及以下
		 */
		public static String SIX_MONTH_OR_LESS = "SIX_MONTH_OR_LESS";
		/**
		 * 7-12个月
		 */
		public static String SEVEN_TWELF_MONTH = "SEVEN_TWELF_MONTH";
		/**
		 * 13-24个月
		 */
		public static String THIRTEEN_TWENTYFOUR_MONTH = "THIRTEEN_TWENTYFOUR_MONTH";
		/**
		 * 24个月及以上
		 */
		public static String TWENTYFOUR_MONTH_OR_MORE = "TWENTYFOUR_MONTH_OR_MORE";
	}

	/**
	 * 获取投资期限单位
	 * 
	 * @param ivsmtmlmttype
	 *            投资期限类型
	 * @return String
	 */
	public static String getLimttype(String ivsmtmlmttype) {

		String limttype = "";

		if (TextUtils.equals(ivsmtmlmttype, "DAY")) {
			limttype = "天";
		} else if (TextUtils.equals(ivsmtmlmttype, "MONTH")) {
			limttype = "月";
		}

		return limttype;
	}
	
	
	/**
	 * 还款方式
	 * 
	 * @param refundWay  还款方式
	 * @return String
	 */
	public static String EnumRefundWay(String refundWay) {

		String mRefundWay = "";
		
		if (TextUtils.equals(refundWay, "ONCE_TIME")) {
			mRefundWay = "到期还本付息";
		} else if (TextUtils.equals(refundWay, "MONTH_PROFIT")) {
			mRefundWay = "按月付息到期还本";
		}else if (TextUtils.equals(refundWay, "QUARTER_PROFIT")) {
			mRefundWay = "按季付息到期还本";
		}else if (TextUtils.equals(refundWay, "HALFYEAR_PROFIT")) {
			mRefundWay = "按半年付息到期还本";
		}else if (TextUtils.equals(refundWay, "MONTH_AMT")) {
			mRefundWay = "按月等额本息";
		}else if (TextUtils.equals(refundWay, "MONTH_PRINCIPAL")) {
			mRefundWay = "按月等额本金";
		}

		return mRefundWay;
	}
	
	/**
	 * 计息方式
	 * 
	 * @return String
	 */
	public static String EnumIntMode(String inMode) {

		String mInMode = "";
		
		if (TextUtils.equals(inMode, "THE_DAY_BEARING")) {
			mInMode = "当日计息";
		} else if (TextUtils.equals(inMode, "MORROW_BEARING")) {
			mInMode = "次日计息";
		}else if (TextUtils.equals(inMode, "SATISFY_BEARING")) {
			mInMode = "满标计息";
		}else if (TextUtils.equals(inMode, "ESTABLISH_BEARING")) {
			mInMode = "成立计息";
		}

		return mInMode;
	}
	

	/**
	 * 计息方式
	 * 
	 */
	public enum EnumIntMode {
		/** 当日计息 */
		THE_DAY_BEARING("1", "当日计息"),
		/** 次日计息 */
		MORROW_BEARING("2", "次日计息"),
		/** 满标计息 */
		SATISFY_BEARING("3", "满标计息"),
		/** 成立计息 */
		ESTABLISH_BEARING("4", "成立计息");

		private String code;

		private String description;

		private EnumIntMode(String code, String description) {

			this.code = code;
			this.description = description;

		}

		/**
		 * 根据结算周期代码获取结算周期枚举
		 * 
		 * @param code
		 *            结算周期代码
		 * @return 结算周期枚举实例
		 */
		public static EnumIntMode find(String code) {

			for (EnumIntMode assetAcctApplicaEnum : EnumIntMode.values()) {
				if (assetAcctApplicaEnum.getCode().equals(code)) {
					return assetAcctApplicaEnum;
				}
			}
			return null;
		}

		/**
		 * @return 结算周期代码
		 */
		public String getCode() {
			return code;
		}

		/**
		 * @return 结算周期信息
		 */
		public String getDescription() {
			return description;
		}

	}

	/**
	 * 
	 * 营销商品状态
	 * 
	 */
	public enum EnumMarketGoodsStatus {
		/** 销售中 */
		SCALEING("SCALEING", "销售中"),
		/** 销售完毕 */
		SCALE_COMPLETED("SCALE_COMPLETED", "销售完毕");

		/** 状态 */
		private String status;
		/** 状态描述 */
		private String description;

		/**
		 * 私有构造方法
		 * 
		 * @param status 状态
		 * @param description 描述
		 */
		private EnumMarketGoodsStatus(String status, String description) {
			this.status = status;
			this.description = description;
		}

		/**
		 * 根据编码查找枚举
		 * 
		 * @param code  编码
		 * @return {@link EnumMarketGoodsStatus} 实例
		 */
		public static EnumMarketGoodsStatus find(String code) {
			for (EnumMarketGoodsStatus frs : EnumMarketGoodsStatus.values()) {
				if (frs.getStatus().equals(code)) {
					return frs;
				}
			}
			return null;
			// throw new Exception("错误码", "根据code=" + code+ "获取渠道标示失败");
		}
		
		/**
	     * 根据枚举查找描述
	     * 
	     * @param status 枚举
	     * @return String
	     **/
	    public static String getDescription(String status) {
	    	for (EnumMarketGoodsStatus frs : EnumMarketGoodsStatus.values()) {
	            if (frs.status.equals(status)) {
	                return frs.description;
	            }
	        }
			return status;
	    }

		public String getStatus() {
			return status;
		}

		public String getDescription() {
			return description;
		}
	}
	
	
}
